<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateAgentMerchantWithdraw extends Migrator
{
    public function up()
    {
        $sql = <<<SQL
CREATE TABLE `agent_merchant_withdraw` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `merchant_id` int(11) DEFAULT NULL COMMENT '商户id',
  `created_at` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  `updated_at` timestamp NULL DEFAULT NULL,
  `amount` varchar(255)  DEFAULT NULL COMMENT '总金额',
  `status` tinyint(1) DEFAULT '1' COMMENT '状态(1:提现,2:已通过,3:已打款)',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ;


SQL;
        $this->execute($sql);

        $sql = <<<SQL
CREATE TABLE `agent_merchant_withdraw_item` (
  `agent_merchant_withdraw_id` int(11) NOT NULL,
  `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '类型(1:统计提现,2:提现表id)',
  `relation_id` int(11) NOT NULL COMMENT '关联id'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
SQL;
        $this->execute($sql);


    }

    public function down()
    {
        $this->table('agent_merchant_withdraw')->drop();
        $this->table('agent_merchant_withdraw_item')->drop();
    }
}
